
import { WebsiteConfig, PermissionConfig } from "maishu-chitu-admin";
import { merchantRoleId } from "../merchant";
import { menuItemIds } from "shop";
import { ConnectionConfig } from "mysql";

export let stationPath = "/account/"
export let projectName = "account";
export type ServerContentData = { db: ConnectionConfig };

export let permissions: PermissionConfig = {}
permissions[`${stationPath}*`] = { roleIds: [merchantRoleId] };

let websiteConfig: WebsiteConfig = {
    requirejs: {
        paths: {
            // "maishu-chitu-admin/static": "node_modules/maishu-chitu-admin/out/static/index"
        }
    },
    menuItems: [
        {
            id: "639B4E53-6DDF-4252-9A5F-63632E22DD1F", name: "收款账号", sortNumber: 80,
            path: "#finance/receivement-account", parentId: menuItemIds.setting
        },

    ]
}

let stack = [...websiteConfig.menuItems];
while (stack.length > 0) {
    let item = stack.shift();
    item.roleIds = [merchantRoleId];
    (item.children || []).forEach(child => {
        stack.unshift(child);
    })
}

export default websiteConfig;